package com.orphan.marketFront.util;

import lombok.Data;

import java.io.Serializable;

@Data
public class ResultVO implements Serializable {
    private Integer code;
    private String message;
    private Object data;


    public ResultVO(ResultCode resultCode, Object data){
        this.code = resultCode.code();
        this.message = resultCode.message();
        this.data = data;
    }
    public ResultVO(ResultCode resultCode){
        this.code = resultCode.code();
        this.message = resultCode.message();
    }
    // 返回成功
    public static com.orphan.marketFront.util.ResultVO success(ResultCode resultCode){
        com.orphan.marketFront.util.ResultVO resultVO = new com.orphan.marketFront.util.ResultVO(resultCode);
        return resultVO;
    }
    // 返回成功
    public static com.orphan.marketFront.util.ResultVO success(Object data){
        com.orphan.marketFront.util.ResultVO resultVO = new com.orphan.marketFront.util.ResultVO(ResultCode.SUCCESS,data);
        return resultVO;
    }
    // 返回失败
    public static com.orphan.marketFront.util.ResultVO fail(ResultCode resultCode){
        com.orphan.marketFront.util.ResultVO resultVO = new com.orphan.marketFront.util.ResultVO(resultCode);
        return resultVO;
    }
    // 返回失败
    public static com.orphan.marketFront.util.ResultVO fail(ResultCode resultCode, Object data){
        com.orphan.marketFront.util.ResultVO resultVO = new com.orphan.marketFront.util.ResultVO(resultCode,data);
        return resultVO;
    }



    public static com.orphan.marketFront.util.ResultVO fail(Integer code , String message){
        com.orphan.marketFront.util.ResultVO resultVO = new com.orphan.marketFront.util.ResultVO(code,message);
        return resultVO;
    }

    public ResultVO(Integer code , String message){
        this.code = code;
        this.message = message;
    }
}

